package com.hyk.commonLib.common.adapter;

import java.util.Iterator;

public abstract class BaseSingleSelectAdapter<VH extends BaseViewHolder<?, ?>, ITEM> extends BaseSelectAdapter<VH, ITEM> {
    @Override
    public void setCheckState(int position, boolean checkState) {
        if (!checkState) return;
        if (checkStateList.get(position) == checkState) return;
        Iterator<Boolean> checkStateIterator = checkStateList.iterator();
        int i = 0;
        while (checkStateIterator.hasNext()) {
            if (checkStateIterator.next()) {
                checkStateList.set(i, false);
                notifyItemChanged(i);
            }
            i++;
        }
        super.setCheckState(position, checkState);
    }
}
